CMAKE_MINIMUM_REQUIRED(VERSION 3.24)

SET( ORIG_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} )

SET( CMAKE_PREFIX_PATH ${ANGELSCRIPT_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
FIND_PACKAGE(ANGELSCRIPT REQUIRED)

SET( CMAKE_PREFIX_PATH ${CLIPPER2_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
FIND_PACKAGE(Clipper2 REQUIRED)

SET( CMAKE_PREFIX_PATH ${CMINPACK_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
FIND_PACKAGE(CMINPACK REQUIRED)

SET( CMAKE_PREFIX_PATH ${CODEELI_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
FIND_PACKAGE(CodeEli 0.3.6 REQUIRED)

SET( CMAKE_PREFIX_PATH ${CPPTEST_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
FIND_PACKAGE(CPPTest REQUIRED)

SET( CMAKE_PREFIX_PATH ${DELABELLA_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
FIND_PACKAGE(delabella REQUIRED)

# Add Eigen3 and Code-Eli
SET( CMAKE_PREFIX_PATH ${EIGEN_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
FIND_PACKAGE(Eigen3 3.0.0 REQUIRED NO_MODULE)

SET( CMAKE_PREFIX_PATH ${LIBIGES_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )

find_library(LIBIGES_LIBRARIES NAMES iges_static
        HINTS ${LIBIGES_INSTALL_DIR}/lib ${LIBIGES_INSTALL_DIR}/bin
)

find_path(LIBIGES_INCLUDE_DIR iges/libigesconf.h
        HINTS ${LIBIGES_INSTALL_DIR}/include
)
SET( LIBIGES_INCLUDE_DIR  ${LIBIGES_INCLUDE_DIR} ${LIBIGES_INCLUDE_DIR}/iges ${LIBIGES_INCLUDE_DIR}/geom )

SET( CMAKE_PREFIX_PATH ${LIBXML2_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
FIND_PACKAGE(LibXml2 REQUIRED)

SET( CMAKE_PREFIX_PATH ${OPENABF_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
FIND_PACKAGE(OpenABF REQUIRED)

SET( CMAKE_PREFIX_PATH ${PINOCCHIO_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
FIND_PACKAGE(pinocchio REQUIRED)

# Searches from ${STEPCODE_INSTALL_DIR} directly.
FIND_PACKAGE(STEPCODE REQUIRED)

SET( CMAKE_PREFIX_PATH ${TRIANGLE_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
FIND_PACKAGE(TRIANGLE REQUIRED)

IF( NOT VSP_NO_GRAPHICS )
    IF( NOT NOREGEXP )
        SET( CMAKE_PREFIX_PATH ${EXPRPARSE_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
        FIND_PACKAGE(exprparse REQUIRED)
    ENDIF()

    SET( CMAKE_PREFIX_PATH ${FLTK_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
    SET( FLTK_DIR ${FLTK_INSTALL_DIR})
    FIND_PACKAGE(FLTK CONFIG REQUIRED)


    SET( CMAKE_PREFIX_PATH ${GLEW_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
    # Use built-in FindGLEW.cmake
    FIND_PACKAGE(GLEW_VSP REQUIRED)

    SET( CMAKE_PREFIX_PATH ${GLM_INSTALL_DIR} ${ORIG_CMAKE_PREFIX_PATH} )
    FIND_PACKAGE( GLM )
ENDIF()

SET( CMAKE_PREFIX_PATH ${ORIG_CMAKE_PREFIX_PATH} )
